object GCD {
  def gcd(_x: Int, _y: Int): Int = {
    var x: Int = _x
    var y: Int = _y
    while (y != 0) {
      val rear = x % y
      x = y
      y = rear
    }
    x
  }

  def main(args: Array[String]) {
    println(gcd(24, 36))
  }
}